Skip to content

fix(cli): open Remix/Expo/Vite previews without the agent, unblock project .codeam/ - #1026

Merged
edgar-durand merged 1 commit into
mainfrom
fix/preview-deterministic-detection
Nov 23, 2026
Merged

edgar-durand merged 1 commit into
mainfrom
fix/preview-deterministic-detection

Conversation

@edgar-durand

@edgar-durand edgar-durand commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Why

2026-11-23, prod: a Remix export (Pasito — Expo SDK 54 + server/ + root remix.json) opened on a Box with Antigravity. The agent's start_preview failed with "Project detection timed out after 120 s — the agent did not answer" (the agy -p detect one-shot never answered), so the agent ran npx expo start --web in its own bash, outside our Preview pane. In the same flow, the agent's attempt to write the project's documented .codeam/preview.json override was auto-blocked as "CodeAgent's own runtime files (~/.codeam)".

What

  • Deterministic detection (services/preview/known-project.ts detectKnownProject), tried after .codeam/preview.json and before the agent one-shot and its availability check:
    • Remix export (root remix.json): MOBILE / expo-app / expo dep / registerRootComponent entry -> the Expo detection the agent returns (npx expo start, 8081, no --tunnel; the Expo bring-up installs the web packages and serves the web build in the pane + Expo Go link). WEB -> Vite (npm run dev -- --host 0.0.0.0 for a vite dev script, else npx vite --host 0.0.0.0 --port 5173, since Remix web templates only declare build).
    • A Remix server/ (Hono on Cloudflare Workers + D1, reached through __REMIX_SERVER_BASE__) can't run locally: the client comes up and notes says so.
    • Plain single-package Expo (expo + app.json/app.config.*) or Vite (dev: vite …). Monorepos keep the agent.
    • Log line detect: path=preview.json|deterministic kind=…|agent. A timed-out one-shot now logs the agent's stderr tail. The prewarm skips its one-shot for these projects.
  • Antigravity one-shot: --print-timeout now ends 10 s before the caller's budget (it was equal to the Preview's 120 s deadline, so agy's own timeout and partial answer could never arrive first).
  • ACP internals guard: each .codeam mention is resolved against the session cwd and blocked only under HOME ~/.codeam. When the repo is cloned AT home, only .codeam/preview.json and .codeam/provision/ are allowed.

Tests

New __tests__/preview/known-project.test.ts (Remix mobile/web, plain Expo/Vite, monorepos, the no-one-shot runtime) and new guard cases in internal-paths.test.ts (project .codeam/, a repo at home). tsc --noEmit is clean. Suites in the touched areas pass. On this machine the full-suite failures differ from run to run: timer and subprocess tests that pass when run alone. acp.adapterModuleGraph.int also fails on main locally.

🤖 Generated with Claude Code


Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…oject .codeam/

- Preview detection: after .codeam/preview.json and BEFORE the agent one-shot
  (and before the generateOneShot availability check), detectKnownProject
  answers projects whose start command is certain: a Remix export (root
  remix.json; MOBILE -> the Expo detection, WEB -> Vite), a plain single-package
  Expo app or a Vite app whose dev script is `vite`. Monorepos keep the agent.
  The debug log names the path (preview.json | deterministic | agent) and a
  timed-out one-shot now logs the agent's stderr tail. The prewarm no longer
  bills a one-shot for these projects. (2026-11-23: a Remix Expo export on a
  Box with Antigravity never got an answer from `agy -p` in 120 s.)
- Antigravity one-shot: --print-timeout ends 10 s before the caller's budget so
  agy's own timeout (partial answer + reason) lands before the Preview deadline.
- ACP internals guard: a `.codeam` mention is resolved against the session cwd
  and blocked only under the HOME ~/.codeam; a repo cloned AT home still gets
  .codeam/preview.json and .codeam/provision/. Writing the project's own
  .codeam/preview.json was auto-blocked as "CodeAgent's own runtime files".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@edgar-durand
edgar-durand merged commit 36988f8 into main Nov 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants